package com.PQLoad
{
	public class FileCheck
	{
		static public const IMG:String="file_type_is_img";
		static public const SWF:String="file_type_is_swf";
		static public const XML:String="file_type_is_xml";
		static public const UNKNOW:String="unknown file type";
		public function FileCheck()
		{
		}
		static public function checkUrl(url:String):String{
			if(!url||url=="")return UNKNOW;
			url=url.toLocaleLowerCase();
			if(url.indexOf(".asp")!=-1||url.indexOf(".aspx")!=-1||url.indexOf(".jsp")!=-1||url.indexOf(".php")!=-1||url.indexOf(".exe")!=-1)return UNKNOW;
			url=url.substr(url.length-5);
			if(url.indexOf(".")>1)return UNKNOW;
			if(url==".jpeg")return IMG;
			url=url.substr(2);
			if(url=="jpg"||url=="png"||url=="bmp"||url=="gif")return IMG;
			if(url=="swf")return SWF;
			if(url=="xml")return XML;
			return UNKNOW;
		}
		static public function isImg(url:String):Boolean{
			if(checkUrl(url)==IMG)return true;
			return false;
		}
		static public function isSwf(url:String):Boolean{
			if(checkUrl(url)==SWF)return true;
			return false;
		}
		static public function isXml(url:String):Boolean{
			if(checkUrl(url)==XML)return true;
			return false;
		}
		
	}
}